package com.fosu.service.impl;

import com.fosu.common.ResponseResult;
import com.fosu.dao.RoleDao;
import com.fosu.dao.UserAndRoleDao;
import com.fosu.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;

/**
 * @author 郭俊求
 * @date 2020/11/9
 */
@Service
@Transactional
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleDao roleDao;

    @Autowired
    private UserAndRoleDao userAndRoleDao;

    @Override
    public ResponseResult findAll(HttpServletResponse resp) {
        return ResponseResult.ok(resp,"获取角色列表成功",roleDao.findAll());
    }

    @Override
    public ResponseResult findUserAndRoleById(HttpServletResponse resp, int userId) {
        return ResponseResult.ok(resp,"获取用户对应角色id成功",userAndRoleDao.findUserAndRoleById(userId));
    }
}
